package com.bio.service.right.impl;

import com.bio.dao.right.TypemenuDao;
import com.bio.entity.right.Typemenu;
import com.bio.service.impl.AbstractService;
import com.bio.service.right.TypemenuService;

public class TypemenuServiceImpl extends AbstractService<Typemenu, TypemenuDao> implements TypemenuService{

	public TypemenuServiceImpl(TypemenuDao dao) {
		super(dao);
	}

	@Override
	public void saveOrUpdateAll(Long[] menuIds, Long userTypeId) {
		this.dao.removeAllByUsertype(userTypeId);
		for(Long mid : menuIds){
			Typemenu t = new Typemenu();
			t.setMenuId(mid);
			t.setUserTypeId(userTypeId);
			this.dao.save(t);
		}
	}

}
